-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Editor Core Packaging and Restructuring #2358
Conversation
0058900
to
a9d197c
Compare
@Palanikannan1437 Can you please add |
Sure thing, I'll make those changes 🙌 |
I've added the updated docs for the editor core, rich text editor and lite text editor with detailed description, props passable, examples and exported components in detail as you had asked. https://github.com/makeplane/plane/blob/comment-editor/packages/editor/core/Readme.md |
2fa9f9d
to
b6f1cb7
Compare
Description
This PR represents a significant milestone in our ongoing efforts to enhance the Developer Experience (DX) and functionality of our editor packages. After weeks of dedicated development, we have successfully restructured our editor packaging, resulting in a more streamlined, efficient, and powerful system.
Key Changes
We now have created three distinct packages
The
rich-text-editor
andlite-text-editor
packages extend from theeditor-core
package, inheriting its base functionality while adding their own unique features. The@plane/editor-core
package serves as the foundation for our editor system, but it will not be used directly in any of the projects.New Features
withRef
instance whenever you want to control the Editor’s state via a side effect of some external action from within the application code.editor-core
package.Read Only
Editor instance for both the Rich and Lite editor types.Refactoring
1.
Rich/LiteTextEditor
,2.
Rich/LiteTextEditorWithRef
,3.
Rich/LiteReadOnlyEditor
,4.
Rich/LiteReadOnlyEditorWithRef
,Testing:
Before merging this PR, please test it locally to ensure everything works as expected, especially with the new build steps.
How to use the different packages
Installation locally in the monorepo
yarn
to install the packageUsage and customization
The
TiptapEditor
component is a highly customizable rich text editor based on the ProseMirror toolkit, wrapped in a React component. As such, it can be used as a standard React component within our application.Here's a brief overview of the
TiptapEditor
component's props and how to use them:Sure, here's the information in a markdown table format:
uploadFile
UploadImage
deleteFile
DeleteImage
value
string
debouncedUpdatesEnabled
boolean
onChange
event handler is debounced, meaning it will only be invoked after the specified delay (default 1500ms) once the user has stopped typing.onChange
(json: any, html: string) => void
setIsSubmitting
(isSubmitting: "submitting" | "submitted" | "saved") => void
setShouldShowAlert
(showAlert: boolean) => void
noBorder
boolean
borderOnFocus
boolean
customClassName
string
editorContentCustomClassNames
string
Here is an example of how to use the
RichTextEditor
component:In this example,
fileService.uploadFile
andfileService.deleteImage
are functions that handle file upload and deletion, respectively. Thevalue
andworkspaceSlug
are provided as props, and several other props are used to configure the editor's appearance and behavior. TheonChange
propSimilarly you can use
LiteTextEditor
,For the Read Only instances, like
LiteReadOnlyTextEditor
, you can do this,What about fine control over Editor's content state?
You can pass a ref to the editor by using
RichTextEditorWithRef
in the following way,Future Plans